# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-cmudict
pkgver=1.0.13
pkgrel=2
pkgdesc="A versioned Python wrapper package for The CMU Pronouncing Dictionary data files"
url="https://github.com/prosegrinder/python-cmudict"
arch="noarch"
license="GPL-3.0-only"
depends="python3"
makedepends="py3-gpep517 py3-installer py3-poetry-core"
checkdepends="py3-pytest"
_cmudict_rev="697cd8957daa07d2cb89e0cee922de6218afde81"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/prosegrinder/python-cmudict/archive/refs/tags/v$pkgver.tar.gz
	$pkgname-$pkgver-data.tar.gz::https://github.com/cmusphinx/cmudict/archive/$_cmudict_rev.tar.gz
	"
builddir="$srcdir/python-cmudict-$pkgver"

prepare() {
	default_prepare

	mv "$srcdir"/cmudict-$_cmudict_rev/* src/cmudict/data/
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/cmudict*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/cmudict*.whl
}

sha512sums="
6b867c748142f2d6f2c52910ed5da68721298d2b78768893ad206dc8f190a5fb8f3ba0ec9e967f056d31dc3b323b0df0f390493a3d21a91cc4ddc6153eece8fd  py3-cmudict-1.0.13.tar.gz
20d3b2465e9045f1eee164a0040f1075d82ba6ed97204fbfc226eaf44b5abb9f20c6c6b06e8e78b4b35d5a55f472b3a3755742474fe1c521f367b87756f8ce4a  py3-cmudict-1.0.13-data.tar.gz
"
